home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / processes / mp threaded sort / sprocket.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  5.0 KB  |  195 lines

  1. /*
  2.     File:        Sprocket.h
  3.  
  4.     Contains:    Prototypes for the “guts” of a Macintosh application.
  5.  
  6.     Written by: Dave Falkenburg    
  7.  
  8.     Copyright:    Copyright © 1993-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/27/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 11/12/94    DRF                AppConditionals.h is now BuildConditionals.h.  Also revised some
  21.                                             QuickDrawGX stuff.
  22.                   11/8/94    DRF                Add prototype for DragDestinationIsTheTrash.
  23.                  9/27/94    DRF                Changed filename to Sprocket.h. Also made scrap coercion
  24.                                              routines more explicit.
  25.                    9/9/94    DRF                Reordered headers and removed redundant #includes.
  26.                    9/4/94    DRF                Added scroll bar constants.
  27.  
  28. */
  29.  
  30. #ifndef        _SPROCKET_
  31. #define        _SPROCKET_
  32.  
  33. #ifndef        _BUILDCONDITIONALS_
  34. #include    "BuildConditionals.h"
  35. #endif
  36.  
  37. #ifndef        __TYPES__
  38. #include    <Types.h>
  39. #endif
  40.  
  41. #ifndef        __WINDOWS__
  42. #include    <Windows.h>
  43. #endif
  44.  
  45. #ifndef        __DIALOGS__
  46. #include    <Dialogs.h>
  47. #endif
  48.  
  49. #ifndef        __STANDARDFILE__
  50. #include    <StandardFile.h>    //    for ModalFilterYDUPP
  51. #endif
  52.  
  53. #ifndef        __DRAG__
  54. #include    <Drag.h>
  55. #endif
  56.  
  57. #include    "Preferences.h"
  58. #include    "Window.h"
  59.  
  60. #if    qUseQuickDrawGX
  61. #include    <FixMath.h>            //    make sure we don’t use GX lame #define of “fixed1”
  62. #include    <graphics types.h>
  63. #endif
  64.  
  65. //    useful macros
  66.  
  67. #if    qDebug
  68. #define    DebugMessage(x)    DebugStr(x)
  69. #else
  70. #define    DebugMessage(x)
  71. #endif
  72.  
  73. //    Resource IDs
  74.  
  75. #define    kErrorAlertID                        128
  76. #define    kStandardCloseAlertID                129
  77. #define    kStandardCloseWithNewPubsAlertID    130
  78.  
  79. #define    kCoreErrorStrings                    128
  80. #define    kUnsupportedSystemSoftware            1
  81. #define    kNeedsThreadManager                    2
  82. #define    kNeedsQuickdrawGX                    3
  83.  
  84. #define    kStandardCloseStrings                129
  85. #define    kQuittingStr                        1
  86. #define    kClosingStr                            2
  87.  
  88. #define    kPreferencesFileStrings                130
  89. #define    kPreferencesFileName                1
  90.  
  91. #define    kSplashPictureID                    128
  92.  
  93. #if        qUseQuickDrawGX
  94. #define    kUseGraphicsSizeResource        0
  95. #define    kAllowGXToExtendGraphicsHeap    ((gxClientAttribute) 0)
  96. #endif
  97.  
  98. //    Useful constants
  99.  
  100. enum
  101.     {
  102.     kScrollbarWidth = 16,    //    width of a standard Macintosh scrollbar
  103.     kScrollbarTweak = 2        //    left edge = rightedge - kScrollbarWidth + kScrollbarTweak
  104.     };
  105.  
  106. //    Useful functions provided by App:
  107.  
  108. void                    HandleEvent(EventRecord *anEvent);
  109. void                    HandleClose(WindowPtr aWindow);
  110.  
  111. short                    StandardAlert(    short alertID,
  112.                                         short defaultItem                = ok,
  113.                                         short cancelItem                = 0,
  114.                                         ModalFilterUPP customFilterProc    = nil);
  115.  
  116. void                    ErrorAlert(short stringList,short whichString);
  117. void                    FatalErrorAlert(short stringList,short whichString);
  118.  
  119. extern ModalFilterUPP    StandardDialogFilter;
  120. extern ModalFilterYDUPP    StandardDialogFilterYD;
  121. extern void                PseudoClickInDialogItem(DialogPtr theDialog, short itemToClick);
  122.  
  123. enum    StandardCloseResult
  124.     {
  125.     kSaveDocument = 1,
  126.     kCancelSaveDocument = 2,
  127.     kDontSaveDocument = 3
  128.     };
  129.  
  130. StandardCloseResult        StandardCloseDocument(const StringPtr documentType,StringPtr documentName, Boolean hasNewEditions, Boolean quitting);
  131.  
  132. OSErr                    CheckAppleEventForMissingParams(AppleEvent *theAppleEvent);
  133.  
  134. short                    OpenPreferencesResFile(void);
  135.  
  136. Boolean                    DragDestinationIsTheTrash(DragReference theDrag);
  137.  
  138.  
  139. //    AOCE “FrontWindow”-equivalent routine for the Standard Mail package
  140. extern FrontWindowUPP    FrontWindowProcForAOCEUPP;
  141.  
  142. //    Globals
  143.  
  144. extern    Boolean                gDone;
  145. extern    Boolean                gMenuBarNeedsUpdate;
  146.  
  147. extern    Boolean                gHasColorQuickdraw;
  148. extern    Boolean                gHasThreadManager;
  149. extern    Boolean                gHasDragManager;
  150. extern    Boolean                gHasAOCE;
  151. extern    Boolean                gHasDisplayManager;
  152.  
  153. #if    qInlineInputAware
  154. extern    Boolean                gHasTextServices;
  155. extern    Boolean                gHasTSMTE;
  156. #endif
  157.  
  158. #if    qUseQuickDrawGX
  159. extern    Boolean                gHasQuickDrawGX;
  160. extern    long                gQuickDrawGXVersion;
  161. extern    long                gQuickDrawGXPrintingVersion;
  162. extern    gxGraphicsClient    gQuickDrawGXClient;
  163. #endif
  164.  
  165. extern    GrafPtr                gWindowManagerPort;
  166. extern    Rect                gDeskRectangle;
  167. extern    RgnHandle            gMouseRegion;
  168.  
  169. extern    short                gPreferencesRsrcRefNum;
  170.  
  171.  
  172. /////////////////////////////////////////////////////////////////
  173. //
  174. //    Routines that the application MUST supply:
  175.  
  176.  
  177. //        intialization & tear down
  178. extern    OSErr    SetupApplication(void);
  179. extern    void    TearDownApplication(void);
  180.  
  181. //        menu handling:
  182. extern    void    HandleMenu(TWindow * topWindowObj,long menuCode);
  183.  
  184. //        scrap coercion hooks:
  185. extern    void    WriteLocalClipboardToScrap(void);
  186. extern    void    ReadLocalClipboardFromScrap(void);
  187.  
  188. //        document handling routines:
  189. extern    OSErr    CreateNewDocument(void);
  190. extern    OSErr    OpenDocument(LetterDescriptor *,void *);
  191. extern    OSErr    PrintDocument(LetterDescriptor *,void *);
  192. extern    Boolean    QuitApplication(void);
  193.  
  194. #endif
  195.